package com.zretc.controller;

import com.github.pagehelper.PageInfo;
import com.zretc.entity.Track;
import com.zretc.service.InStoreManageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.HashMap;
import java.util.Map;

@Controller
@RequestMapping("/inStore")
public class InStoreManageController {

    @Autowired
    private InStoreManageService inStoreManageService;

    @RequestMapping("/findInStoreList")
    @ResponseBody
    public PageInfo<Track> findInStoreList(@RequestParam(value = "pageNum") Integer pageNum,
                                @RequestParam(value = "pageSize") Integer pageSize,
                                String opCode, String houseName, String orderId){
        Map<String, Object> map = new HashMap<>();
        map.put("pageNum",pageNum);
        map.put("pageSize",pageSize);
        map.put("opCode",opCode);
        map.put("houseName",houseName);
        map.put("orderId",orderId);

        // 调用业务层方法，查询入库信息
        PageInfo<Track> inStoreList = inStoreManageService.findInStoreList(map);

        return inStoreList;
    }

    @RequestMapping("/delete")
    @ResponseBody
    public int deleteInStoreByOrderId(@RequestParam(value = "orderId") String orderId){
        // 调用业务层的删除入库信息方法
        return inStoreManageService.deleteInStoreByOrderId(orderId);
    }
}
